﻿# CMakeList.txt: ProjectManager 的 CMake 项目，在此处包括源代码并定义

CMAKE_MINIMUM_REQUIRED(VERSION 3.15.0 FATAL_ERROR)



#=========================配置项目信息=======================================

# 项目名称
PROJECT(ProjectManager LANGUAGES CXX)

# 设置生成动态库(默认静态库)
SET(BUILD_SHARED_LIBS ON)

# 包含当前目录
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

# 定义DLL导出符号宏定义
ADD_DEFINITIONS("-DAPI_ProjectManager")

# 引入所有H文件和CPP文件
FILE(GLOB SRC_H_FILES "*.h")
FILE(GLOB SRC_CPP_FILES "*.cpp")

# 将源代码添加到此项目的可执行文件
ADD_LIBRARY(${PROJECT_NAME} ${SRC_H_FILES} ${SRC_CPP_FILES})

# 包含头文件目录
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 
    PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/..
    ${LIBRARY_VTK_INCLUDE}
    ${LIBRARY_QUAZIP_INCLUDE}
    ${LIBRARY_QCustomPlot_INCLUDE}
    ${LIBRARY_OPENCV_INCLUDE}
)

# 配置编译选项
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
    SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
ENDIF()    



# =================引入外部依赖库==================

FIND_PACKAGE(Qt5 COMPONENTS Xml REQUIRED)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} Qt5::Xml)

TARGET_LINK_DIRECTORIES(${PROJECT_NAME} PRIVATE ${PROJECT_MODULE_OUTPUT_DIR})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} BaseModule BaseWidget DataManager)
ADD_DEPENDENCIES(${PROJECT_NAME} BaseModule BaseWidget DataManager)



# ==================打印环境信息==================

# 打印项目路径
#MESSAGE( STATUS "{${PROJECT_NAME}} 项目目录 = ${PROJECT_SOURCE_DIR}" )
FOREACH(LIBRARY_VTK_LIB ${LIBRARY_VTK_LIBS})
    TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBRARY_VTK_LIB})
ENDFOREACH()
FOREACH(LIBRARY_QUAZIP_LIB ${LIBRARY_QUAZIP_LIBS})
    TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBRARY_QUAZIP_LIB})
ENDFOREACH()
FOREACH(LIBRARY_QCustomPlot_LIB ${LIBRARY_QCustomPlot_LIBS})
	TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBRARY_QCustomPlot_LIB})
ENDFOREACH()
FOREACH(LIBRARY_OPENCV_LIB ${LIBRARY_OPENCV_LIBS})
	TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBRARY_OPENCV_LIB})
ENDFOREACH()
